all: q1 wc

# Create build directory
build/.exist:
	@mkdir -p build
	@touch build/.exist

# make and run question 1
q1: build/.exist
	@gcc -o build/q1 question1.c -lpthread -Wall
	@./build/q1

# make and run workcrew
wc: build/.exist
	@gcc -o build/wc -Iworkcrew workcrew/*.c -lpthread -Wall
	@./build/wc

md5: build/.exist
	@gcc -o build/md5 md5_compute.c -lpthread -lcrypto -Wall \
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib 	# For OSX
	@./build/md5

mdc: build/.exist
	@gcc -o build/mdc md5_collision.c -lpthread -lcrypto -Wall \
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib 	# For OSX
	@./build/mdc

# Clean objects under build/
.PHONY: clean
clean:
	@rm build/*